pkgname=leaking-addresses
pkgver=4f19048
pkgrel=1
arch=('i386' 'x86_64')
url="https://raw.githubusercontent.com/torvalds/linux/master/scripts/leaking_addresses.pl"
license=('GPL')
makedepends_debian_11=(jq)
source=("https://raw.githubusercontent.com/torvalds/linux/master/scripts/leaking_addresses.pl")
md5sums=('SKIP')

pkgver()
{
	# get the last commit of leaking_addresses.pl
	local info=$(curl -sf https://api.github.com/repos/torvalds/linux/commits\?path\=scripts/leaking_addresses.pl\&per_page\=1 || return)
	local long_commit=$(echo $info | jq '.[0].sha' | tr -d '"')
	echo ${long_commit:0:7}
}

package()
{
	cd $srcdir

	mkdir -p "${pkgdir}/lkp/benchmarks/${pkgname}"
	install -m 755 "${srcdir}"/leaking_addresses.pl "$pkgdir/lkp/benchmarks/${pkgname}/"
}
